#ifndef _MEMORY_
#define _MEMORY_

#ifndef _STD_
#include <std.h>
#endif

void *search_mem(unsigned char *start_pointer,unsigned char search_char,unsigned char *end_pointer);
int swapmem(char *m1,char *m2,size_t length);
int swap32mem(unsigned long *m1,unsigned long *m2,size_t length);

int shift_table_down(int);
int shift_table_up(int);

#define set_allocated(n) flag_table[n]=1
#define set_free(n) flag_table[n]=NULL
#define is_allocated(n) (flag_table[n]&1)

#define make_entry(n,a) mem_table[n]=a
#define insert_entry(n,a) \
	shift_table_down(n); \
	mem_table[n]=a
#define delete_entry(n) shift_table_up(n)
#define allocation_size(n) (mem_table[n+1]-mem_table[n]) 

void *get_mem(size_t b);
#define malloc get_mem
int search_allocation(void *p);
int merge_free();
int free(void *p);
int reallocate(void *old,size_t b);
size_t avg_allocation_size();
int hash_location(void *p);
void init_mm();

int show_table();
size_t avg_allocation_size();
unsigned long mem_occ();
unsigned long sys_occ();

void memspd(u32 alloc);

#endif
